package collectdemo13.collections;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class CollectionsDemo01
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Map<String, Object> map = new HashMap<String, Object>();
		List<Object> list = new ArrayList<Object>();
		list.add("test1");
		list.add("test2");
		list.add("test3");
		list.add("test4");
		list.add("test5");
//		list.add(map);
		list.addAll(list);
		if (list.contains(map)) {
			System.out.println("含有map");
		}
		list.remove(0);
		Iterator<Object> it = list.listIterator();
		while (it.hasNext()) {
			System.out.println(it.next());
		}
 	
		list.clear();
		if (list.isEmpty()) {
			System.out.println("为空，长度=" + list.size());
		}
		Object[] a = new Object[3];
		a = list.toArray(a);
		System.out.println(a);
		list.clear();
		list.add("1");
		list.add("2");
		list.add("3");
		list.add("4");
		Iterator<Object> it1 = list.listIterator();
		while (it1.hasNext()) {
			System.out.println(it1.next());
		}
		
		List<Object> list1 = new ArrayList<Object>(); 
		list1.add(0, list.get(0));
		list1.add(0, list.get(1));
		list1.add(0, list.get(2));
		
		Iterator<Object> it2 = list1.listIterator();
		while (it2.hasNext()) {
			System.out.println("jfjk" + it2.next());
		}
	}

}
